#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;

int dy[] = { 1, 0, -1, 0 };
int dx[] = { 0, 1, 0, -1 };

int main()
{
    int arr[15][15] = { 0 };
    int n, pos = 0, num = 1, x = 1, y = 1;
    cin >> n;
    while (1)
    {
        if (x < 1 || y < 1 || x > n || y > n || arr[x][y])
        {
            x -= dx[pos];
            y -= dy[pos];
            pos = (pos + 1) % 4;
            x += dx[pos];
            y += dy[pos];
            if (arr[x][y]) break;
        }
        arr[x][y] = num++;
        x += dx[pos];
        y += dy[pos];
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            printf("%3d", arr[i][j]);
        }
        printf("\n");
    }
    return 0;
}